﻿using Knihkupectvo.SpocitejCenu;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace VypocitejCenu
{
    public partial class Form1 : Form
    {
        ObjednavkaTest o;
        public Form1()
        {
            InitializeComponent();
        }

        private void bt_spocitej_Click(object sender, EventArgs e)
        {

            o = new ObjednavkaTest(Convert.ToDecimal(tb_cena.Text), chb_sleva.Checked, chb_darkove.Checked, chb_platbacc.Checked, chb_mimoEU.Checked, chb_express.Checked);

            lb_cena.Text = SpocitejCenu(o).ToString("#,## Kč");
        }

        private decimal SpocitejCenu(ISpocitejCenu obj)
        {

            Objednavka objednavka = new Objednavka(obj.cena, obj.jeSleva);

            Postovne post = new Postovne(new DarkoveBaleni(new PlatbaCC(objednavka)), obj.express, obj.eu);

            return post.getCena();
        }
    }
}
